import re
from tools.env_class import Env_Var
def replace_var(excel):
    if excel is None:
        return
    while True:
        re_obj = re.search("#(.*?)#",excel)
        if re_obj is None:
            break
        mark = re_obj.group()
        var = re_obj.group(1) # token_type
        value = getattr(Env_Var,var)
        excel = excel.replace(mark,str(value))
    return excel

if __name__ == '__main__':
    excel = '{"Content-Type":"application/json","Authorization": "#token_type##access_token#"}'
    print(replace_var(excel))